[Backport v4.3-branch] drivers: i2c: i2c_dw: fix target-mode ISR state races and missing START_DET unmask#111414
Open
d3zd3z wants to merge 1 commit into
Open
[Backport v4.3-branch] drivers: i2c: i2c_dw: fix target-mode ISR state races and missing START_DET unmask#111414d3zd3z wants to merge 1 commit into
d3zd3z wants to merge 1 commit into
Conversation
…tate The target ISR gates write_requested() on `dw->state != CMD_SEND` so that back-to-back rx_full interrupts during a single write do not re-enter the callback. However, dw->state is only transitioned back to READY on stop_det. If the STOP interrupt is lost (glitch, bus reset, another master drives STOP while we are servicing the ISR), or if the master issues a repeated START with the same direction (WRITE-Sr-WRITE, which is legal in I2C), the state stays CMD_SEND forever and write_requested() is never called again for the rest of the target's life. i2c_dw_slave_read_clear_intr_bits() already handles start_det by resetting state to READY, but START_DET is not in the enabled interrupt mask in i2c_dw_slave_register(), so that path is dead code. Unmask START_DET so the boundary of every new (re)START on the bus is observed and state is correctly reset before the rx_full handler decides whether to call write_requested(). Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
There was a problem hiding this comment.
Pull request overview
Backports a DesignWare I2C target (slave) fix onto v4.3-branch by enabling START condition detection interrupts so the slave state machine can reset on fresh START conditions, aligning behavior with the I2C target API contract described in the linked issue/PR.
Changes:
- Unmasks
START_DETin the slave-mode interrupt mask (i2c_dw_slave_register()).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1145
to
1148
| write_intr_mask(DW_INTR_MASK_RX_FULL | DW_INTR_MASK_RD_REQ | | ||
| DW_INTR_MASK_TX_ABRT | DW_INTR_MASK_STOP_DET | | ||
| DW_INTR_MASK_START_DET, | ||
| reg_base); |
|
jhedberg
approved these changes
Jun 18, 2026
teburd
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Backport of the fix from #107537 to
v4.3-branch.Fixes: #111412